!!!
%html{ :lang => "en" }
  %head
    %script{ :src => "/js/jquery-3.3.1.min.js" }
    %script{ :src => "/js/jquery-migrate-3.0.0.min.js" }

    %script{ :src => "/bootstrap-4.3.1/js/bootstrap.js" }
    %script{ :src => "/js/format_shortcut.js" }
    %script{ :src => "/js/helpers.js" }

    %meta{ :charset => "utf-8" }/
    %title Serpico
    %meta{ :content => "", :name => "description" }/
    %meta{ :content => "", :name => "author" }/

    %link{ :href => "/css/main.css", :rel => "stylesheet" }/
    %link{ :href => "/bootstrap-4.3.1/css/bootstrap.css", :rel => "stylesheet" }/
    %link{ :href => "/fontawesome-5.7.2/css/all.css", :rel => "stylesheet" }/

  - if valid_session?
    %body
      %nav.navbar.navbar-dark.fixed-top.bg-dark.navbar-expand-md.shadow
        %button.navbar-toggler{ :type => "button", "data-toggle" => "collapse", "data-target" => "#navbarCollapse", "aria-controls" => "navbarCollapse", "aria-expanded" => "false", "aria-label" => "Toggle navigation" }
          %span.navbar-toggler-icon
        %div#navbarCollapse.collapse.navbar-collapse
          %ul.navbar-nav.mr-auto
            %li.nav-item
              %a.nav-link{ :href => "/reports/list" }
                %i.far.fa-file-word
                List Reports
            %li.nav-item
              %a.nav-link{ :href => "/report/new" }
                %i.far.fa-edit
                New Report
          %ul.navbar-nav.ml-auto
            - if is_administrator?
              %li.nav-item.text-nowrap
                %a.nav-link{ :href => "/master/findings" }
                  %i.fas.fa-sitemap
                  Findings Database
            %li.nav-item.text-nowrap
              %a.nav-link{ :href => "/info" }
                %i.fas.fa-info-circle
                Consultant Information
            %li.nav-item.text-nowrap
              %a.nav-link{ :href => "/reset" }
                %i.far.fa-life-ring
                Change Password
            %li.nav-item.text-nowrap
              %a.nav-link{ :href => "/logout" }
                %i.fas.fa-sign-out-alt
                Logout

      .container-fluid
        .row
          %nav.col-md-2.d-none.d-md-block.bg-light.sidebar
            .sidebar-sticky
              - if @master
                %h6.sidebar-heading.d-flex.justify-content-between.align-items-center.px-3.mt-4.mb-1.text-muted
                  %span Findings Menu
                %ul.nav.flex-column
                  %li.nav-item
                    %a.nav-link{ :href => "/master/findings" } List Current Findings
                  %li.nav-item
                    %a.nav-link{ :href => "/master/findings/new" } Add Finding
                %h6.sidebar-heading.d-flex.justify-content-between.align-items-center.px-3.mt-4.mb-1.text-muted
                  %span Database Functions
                %ul.nav.flex-column
                  %li.nav-item
                    %a.nav-link{ :href => "/master/export" } Export Current Findings
                  %li.nav-item
                    %a.nav-link{ :href => "/master/import" } Import Findings

              - elsif @admin
                %h6.sidebar-heading.d-flex.justify-content-between.align-items-center.px-3.mt-4.mb-1.text-muted
                  %span Admin User Menu
                %ul.nav.flex-column
                  %li.nav-item
                    %a.nav-link{ :href => "/admin/add_user" } Add User
                  %li.nav-item
                    %a.nav-link{ :href => "/admin/list_user" } List Users
                %h6.sidebar-heading.d-flex.justify-content-between.align-items-center.px-3.mt-4.mb-1.text-muted
                  %span Admin Report Template Menu
                %ul.nav.flex-column
                  %li.nav-item
                    %a.nav-link{ :href => "/admin/templates/add" } Add Report Template
                  %li.nav-item
                    %a.nav-link{ :href => "/admin/templates" } List Report Templates
                  %li.nav-item
                    %a.nav-link{ :href => "/admin/udo_templates" } Manage UDOs templates for reports
                %h6.sidebar-heading.d-flex.justify-content-between.align-items-center.px-3.mt-4.mb-1.text-muted
                  %span Plugin Menu
                %ul.nav.flex-column
                  %li.nav-item
                    %a.nav-link{ :href => "/admin/plugins" } Enable/Disable Plugins
                  %li.nav-item
                    %a.nav-link{ :href => "/admin/admin_plugins" } Administrator Specific Plugins
                %h6.sidebar-heading.d-flex.justify-content-between.align-items-center.px-3.mt-4.mb-1.text-muted
                  %span Maintenance Menu
                %ul.nav.flex-column
                  %li.nav-item
                    %a.nav-link{ :href => "/admin/config" } Modify Configurations
                  %li.nav-item
                    %a.nav-link{ :href => "/admin/dbbackup" } Backup Master Database
                  %li.nav-item
                    %a.nav-link{ :href => "/admin/attacments_backup" } Backup All Attachments

                - @version = File.open("VERSION.txt").read()
                %h6.sidebar-heading.d-flex.justify-content-between.align-items-center.px-3.mt-4.mb-1.text-muted
                  %span Serpico Version: #{@version}

              - else
                - if @report
                  %h6.sidebar-heading.d-flex.justify-content-between.align-items-center.px-3.mt-4.mb-1.text-muted
                    %span #{@report.report_name}
                  %ul.nav.flex-column
                    %li.nav-item
                      %a.nav-link{ :href => "/report/#{@report.id}/edit" } Edit Report Information
                    %li.nav-item
                      %a.nav-link{ :href => "/report/#{@report.id}/generate" } Generate Report
                  %h6.sidebar-heading.d-flex.justify-content-between.align-items-center.px-3.mt-4.mb-1.text-muted
                    %span Findings
                  %ul.nav.flex-column
                    %li.nav-item
                      %a.nav-link{ :href => "/report/#{@report.id}/findings" } List Current Report Findings
                    %li.nav-item
                      %a.nav-link{ :href => "/report/#{@report.id}/findings_add" } Add Finding from Templates
                    %li.nav-item
                      %a.nav-link{ :href => "/report/#{@report.id}/findings/new" } Create New Finding
                    %li.nav-item
                      %a.nav-link{ :href => "/report/#{@report.id}/import_scan_data" } Import Findings from Scan Data **<em>Beta</em>**
                  %h6.sidebar-heading.d-flex.justify-content-between.align-items-center.px-3.mt-4.mb-1.text-muted
                    %span Attachments
                  %ul.nav.flex-column
                    %li.nav-item
                      %a.nav-link{ :href => "/report/#{@report.id}/upload_attachments" } Upload New Attachment
                    %li.nav-item
                      %a.nav-link{ :href => "/report/#{@report.id}/attachments" } List Attachments
                  %h6.sidebar-heading.d-flex.justify-content-between.align-items-center.px-3.mt-4.mb-1.text-muted
                    %span Metasploit Data Management
                  %ul.nav.flex-column
                    %li.nav-item
                      %a.nav-link{ :href => "/report/#{@report.id}/hosts" } Hosts
                    %li.nav-item
                      %a.nav-link{ :href => "/report/#{@report.id}/vulns" } Vulnerabilities
                    %li.nav-item
                      %a.nav-link{ :href => "/report/#{@report.id}/services" } Services
                  %h6.sidebar-heading.d-flex.justify-content-between.align-items-center.px-3.mt-4.mb-1.text-muted
                    %span Additional
                  %ul.nav.flex-column
                    %li.nav-item
                      %a.nav-link{ :href => "/report/#{@report.id}/additional_features" } Additional Features

                - if @plugin_side_menu
                  %h6.sidebar-heading.d-flex.justify-content-between.align-items-center.px-3.mt-4.mb-1.text-muted
                    %span Enabled Plugins
                  -@plugin_side_menu.each do |item|
                    %ul.nav.flex-column
                      %li.nav-item
                        %a.nav-link{ :href => "#{item["link"]}?report_id=#{@report.id}" } #{item["name"]}
          %main.col-md-9.ml-sm-auto.col-lg-10.px-4.mb-5{ :role => "main" }
            - if @master
              .alert.alert-danger
                %strong WARNING
                %br
                You are editing the Templates Database
              %br
            =yield

  - else
    %body.text-center
      %link{ :href => "/css/signin.css", :rel => "stylesheet" }/
      %form.form-signin{ :action => "/login", :method => "POST", :role => "form" }
        %img.mb-4{ :src => "#{@logo}", :height => 245, :width =>  300 }
        .form-label-group.mb-2
          %label.sr-only{ :for => "username" } Username
          %input#username.form-control{ :autofocus => "", :placeholder => "Username", :required => "", :type => "text", :name=> "username" }
        .form-label-group.mb-4
          %label.sr-only{ :for => "password" } Password
          %input#password.form-control{ :placeholder => "Password", :required => "", :type => "password", :name=> "password", :autocomplete => "off" }
        %button.btn.btn-lg.btn-primary.btn-block{ :type => "submit" } Sign in
